package service;

import java.util.List;

import model.User;
import dao.UserDao;

public class UserService extends BaseService {

	private UserDao userDao;

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	
	public boolean emailIsValid(String email){
		return userDao.getUserByEmail(email) == null;
	}
	
	public void saveOrUpdate(User user){
		userDao.saveOrUpdate(user);
	}
	
	public void delete(Integer id){
		userDao.delete(id);
	}
	
	public List<User> getAll(){
		List<User> user = userDao.getAll();
		return user;
	}
	
	public User get(Integer id){
		return userDao.get(id);
	}

	public boolean isRegisted(String email) {
		return userDao.isRegisted(email);
	}
	
	public User getUserByEmail(String email){
		return userDao.getUserByEmail(email);
	}

	public User getById(Integer id){
		return userDao.getById(id);
	}
}
